package com.info.zhiduoduo.admin.controller;

import com.info.zhiduoduo.admin.model.formbean.system.SearchAddressFormBean;
import com.info.zhiduoduo.admin.service.AddressService;
import com.info.zhiduoduo.common.constants.SmartResult;
import com.info.zhiduoduo.common.formbean.BaseSimpleFormBean;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/addr")
public class AddressController {

	@Autowired
	AddressService addressService;

	@PostMapping("/v1/province")
	public SmartResult getProvince(@RequestBody BaseSimpleFormBean<SearchAddressFormBean> formBean) {
		return addressService.getProvince(formBean);
	}

	@PostMapping("/v1/city")
	public SmartResult getCity(@RequestBody BaseSimpleFormBean<SearchAddressFormBean> formBean) {
		return addressService.getCity(formBean);
	}

	@PostMapping("/v1/county")
	public SmartResult getCounty(@RequestBody BaseSimpleFormBean<SearchAddressFormBean> formBean) {
		return addressService.getCounty(formBean);
	}

	@PostMapping("/v1/all_addr")
	public SmartResult getAllAddr(@RequestBody BaseSimpleFormBean formBean) {
		return addressService.getAllAddr(formBean);
	}

	@PostMapping("/v1/all_city")
	public SmartResult getAllCity(@RequestBody BaseSimpleFormBean formBean) {
		return addressService.getAllCity(formBean);
	}
}
